class Evidence < ActiveRecord::Base
  mount_uploader :picture, PictureUploader
  #validates :picture, file_size: { less_than: 20.megabytes }
  validate :picture_less_than_20MB

  belongs_to :credit_record


  def picture_less_than_20MB
    if picture.file.size.to_f/(1000*1000) > 20 #user.product_upload_limit.to_f
      errors.add(:file, "你不能上传大于20MB的文件。")
    end
  end
end
